<?php

namespace App\Admin\Validate;

use App\Common\Validate\Validate;

class CommonValidate extends Validate
{

    public function login($request)
    {
        $method     = $request->getMethod();
        if ($method=='POST'){
            $post       = $request->post();
            $rules      = [
                'name' => 'required|alphaDash',
                'password' => 'required',
                //'captcha'=>'required|captcha'
            ];
            $messages   = [
                'name' => '账号必填',
                'password' => '密码必填',
                //'captcha'=>'验证码必填'
            ];
            $attributes = [];
            if ($rules) {
                return $this->check($post, $rules, $messages, $attributes);
            }
        }
    }



    /**
     * 获取业务范围修改信息
     * @param RequestInterface $request
     * @throws \App\Exception\ValidateException
     */
    public function getBusinessScopeEditInfo(RequestInterface $request)
    {
        $post       = $request->post();
        $rules      = [
            'department_id' => 'required|integer|bail',
        ];
        $messages   = [];
        $attributes = [

        ];

        if ($rules) {
            $this->check($post, $rules, $messages, $attributes);
        }
    }
}